/**
 * Created by Administrator on 2019/3/5
 * Function:
 * Desc:
 */
 import React, {Component} from 'react';
 import {StyleSheet,Text,View,Button} from 'react-native';
 import PropTypes from 'prop-types';

 export const AppStackNavigator = createStackNavigator({
     HomeScreen:{
         screen:HomeScreen
     },
     Page1:{
         screen:Page1
     }
 });

 export default class MyNavigator extends Component{
    // 属性检测
    static propTypes = {

    };
    // 默认值设置
    static defaultProps = {

    };
    // 初始化state
    constructor(props){
        super(props);
        this.state = {};
    }
    // 加载前
    componentWillMount(): void {
        console.log('componentWillMount')
    }
    // 加载后
    componentDidMount(): void {
        console.log('componentDidMount')
    }
    // 接收改变参数( props或者state改变 )
    componentWillReceiveProps(nextProps: Readonly<P>, nextContext: any): void {
        console.log('componentWillReceiveProps')
    }
    // 是否更新( state改变 )
    shouldComponentUpdate(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean {
        console.log('shouldComponentUpdate')
        return true;
    }
    // 更新前
    componentWillUpdate(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void {
        console.log('componentWillUpdate')
    }
    // 更新后
    componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS): void {
        console.log('componentDidUpdate')
    }
    // 移除前
    componentWillUnmount(): void {
        console.log('componentWillUnmount')
    }


    render(){
        const {navigate} = this.props.navigation;

        return (
            <View>
                <Text>Hello World</Text>
                <Button
                    onPress={()=>{
                        navigate('Page1',{name:'Devio'})
                    }}
                    title={"跳转Page1"}
                />
            </View>

        );
    }


 }

 // 构建样式
const styles = StyleSheet.create({
    /*
    * *******    style属性    *******
    * flexDirection        水平：row   竖直：column
    * justifyContent       flex-start、center、flex-end、space-around、space-between以及space-evenly
    * alignItems           flex-start、center、flex-end、stretch。
    * */
});

